package pe.gob.sunarp.entidad;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the SYSLOG database table.
 * 
 */
@Embeddable
public class SyslogPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;
	private java.util.Date logtime;
	private String objectname;
	private long messageid;

    public SyslogPK() {
    }

    @Temporal( TemporalType.DATE)
	@Column(unique=true, nullable=false)
	public java.util.Date getLogtime() {
		return this.logtime;
	}
	public void setLogtime(java.util.Date logtime) {
		this.logtime = logtime;
	}

	@Column(unique=true, nullable=false, length=128)
	public String getObjectname() {
		return this.objectname;
	}
	public void setObjectname(String objectname) {
		this.objectname = objectname;
	}

	@Column(unique=true, nullable=false)
	public long getMessageid() {
		return this.messageid;
	}
	public void setMessageid(long messageid) {
		this.messageid = messageid;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof SyslogPK)) {
			return false;
		}
		SyslogPK castOther = (SyslogPK)other;
		return 
			this.logtime.equals(castOther.logtime)
			&& this.objectname.equals(castOther.objectname)
			&& (this.messageid == castOther.messageid);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.logtime.hashCode();
		hash = hash * prime + this.objectname.hashCode();
		hash = hash * prime + ((int) (this.messageid ^ (this.messageid >>> 32)));
		
		return hash;
    }
}